﻿<ListBox
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:am="clr-namespace:AppManager"
    xmlns:amc="clr-namespace:AppManager.Controls"
	mc:Ignorable="d"
	x:Class="AppManager.ButtonList"
	d:DesignHeight="75" 
	d:DesignWidth="105" 
	Background="Transparent"
	BorderThickness="0,0"
	PreviewKeyDown="ButtonList_PreviewKeyDown"
	ScrollViewer.HorizontalScrollBarVisibility="Disabled"
	ScrollViewer.VerticalScrollBarVisibility="Auto"
	>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem" >
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate
						TargetType="{x:Type ListBoxItem}">
                        <ContentPresenter
							HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
							VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
							SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ListBox.ItemContainerStyle>
    <ListBox.ItemTemplate>
		<DataTemplate>
			<DataTemplate.Resources>
				<LinearGradientBrush
					x:Key="ToolTipBk"
					EndPoint="348.806,530.234"
					StartPoint="81.194,33.766"
					MappingMode="Absolute">
					<GradientStop
						Color="#FFF8CF75"
						Offset="0" />
					<GradientStop
						Color="#FFBD8B1C"
						Offset="1" />
				</LinearGradientBrush>
				<Style
					x:Key="ToolTipStyle"
					TargetType="{x:Type ToolTip}">
					<Setter
						Property="OverridesDefaultStyle"
						Value="true" />
					<Setter
						Property="VerticalOffset"
						Value="2" />
					<Setter
						Property="HorizontalOffset"
						Value="15" />
					<Setter
						Property="Placement"
						Value="Bottom" />
					<Setter
						Property="TextElement.FontSize"
						Value="11" />
					<Setter
						Property="TextElement.Foreground"
						Value="Black"/>
					<Setter
						Property="Template">
						<Setter.Value>
							<ControlTemplate
								TargetType="{x:Type ToolTip}">
								<Border
									BorderBrush="Black"
									Background="{StaticResource ToolTipBk}"
									BorderThickness="1"
									CornerRadius="3"
									Name="border"
									SnapsToDevicePixels="True">
									<ContentPresenter
										Margin="10,5,10,5"
										HorizontalAlignment="Center"
										VerticalAlignment="Center" />
								</Border>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Style>
			</DataTemplate.Resources>
			<am:AppButton
				Click="ImageButton_Click"
				IsTabStop="False"
				Margin="4,4,4,4"   
                x:Name="AppButton"
				ButtonImageSource="{Binding Path=Source.AppImage}"
				ButtonText="{Binding Path=Source.AppName}"
                IsTitleVisible="{Binding Path=ShowTitle}"
                >
				<am:AppButton.ToolTip>
                    <ToolTip Style="{DynamicResource ToolTipStyle}" Content="{Binding Path=Source.AppPathInfo}"/>	
				</am:AppButton.ToolTip>
			</am:AppButton>
		</DataTemplate>
	</ListBox.ItemTemplate>
	<ListBox.ItemsPanel>
		<ItemsPanelTemplate>
             <amc:AdjustedWrapPanel IsItemsHost="True" />
        </ItemsPanelTemplate>
	</ListBox.ItemsPanel>
</ListBox>